package jp.sinya;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * 请求转发，请求包含，请求转发
 */
public class DemoServlet12 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        PrintWriter writer = resp.getWriter();
        //这里处理请求转发，并没有设置请求头，因为可以使用转发的请求头。
        writer.write("<h3>Get请求 DemoServlet12 处理了 DemoServlet11 的请求转发之后 发出的响应体</h3>");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        PrintWriter writer = resp.getWriter();
        writer.write("<h3>Post请求 DemoServlet12 处理了 DemoServlet11 的请求转发之后 发出的响应体</h3>");
    }
}
